package com.da.javatest.niuke.baodian;

/**
 * @author chenlida
 * @date 2020/10/4 22:18
 * https://www.nowcoder.com/practice/bc12808a2b0f445c96a64406d5513e96?tpId=8&tags=&title=&diffculty=0&judgeStatus=0&rp=1
 */
public class C8ReverseEqual {
    public static void main(String[] args) {
        System.out.println(checkReverseEqual("Hello world", "worldhello "));
        System.out.println(checkReverseEqual("waterbottle", "erbottlewat"));
    }

    public static boolean checkReverseEqual(String s1, String s2) {
        if (s1 == null || s2 == null || s1.length() != s2.length()) {
            return false;
        }
        // s1:abcdabcd s2:cdab
        return (s1 + s1).contains(s2);
    }
}
